package test04;

//员工类
public class Staff {
    private int age;
    private  String name;

    public Staff(){

    }

    public Staff(int age, String name){
        if(age > 150 || age < 18){
            throw new RuntimeException("年龄异常");
        }else{
            this.age = age;
        }

        if(name == null || "".equals(name)){
            throw  new RuntimeException("年龄为空异常");
        }else{
            this.name = name;
        }
    }

    public int getAge() {
        return age;
    }

    public String getName() {
        return name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }
}
